<template>
  <div class="warpper">
    <div class="block flex-x flex-content-space-between">
      <div class="flex-y">
        <div class="title">张三 13812342341</div>
        <div class="grey">北京市 东城区 北京市</div>
      </div>

      <van-icon name="arrow" />
    </div>

    <div class="block">
      <div class="flex-x" style="margin-bottom: 10px;">
        <img class="photo" src="https://picsum.photos/100/120" alt="">
        <div class="flex-y" style="flex: 1; gap: 5px; align-items: flex-start;">
          <div>小米（MI）MIX2</div>
          <div>哈哈哈哈哈哈哈</div>
          <van-tag plain type="danger">8+128 黑色</van-tag>

          <div class="flex-x flex-content-space-between flex-items-center" style="width: 100%;">
            <div class="price">
              ¥4999
            </div>
            <div class="grey">
              x1
            </div>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="title">商品价格</div>
        <div class="grey">4999.00</div>
      </div>
      <div class="row">
        <div class="title">优惠</div>
        <div class="grey">0.00</div>
      </div>
      <div class="row">
        <div class="title">运费</div>
        <div class="grey">免邮费</div>
      </div>
      <div class="row">
        <div class="title">备注</div>
        <van-field v-model="text" label="请输入备注" />
      </div>
    </div>
    <van-radio-group v-model="payment" class="block">
      <div class="row">
        <div class="flex-x flex-items-center">
          <van-icon name="shop-o" />
          <div class="flex-y">
            <div class="title">余额</div>
            <div class="grey">¥622</div>
          </div>
        </div>

        <van-radio name="1"></van-radio>
      </div>
      <div class="row">
        <div class="flex-x flex-items-center">
          <van-icon name="shop-o" />
          <div class="flex-y">
            <div class="title">微信</div>
            <div class="grey">暂未开通</div>
          </div>
        </div>

        <van-radio name="2"></van-radio>
      </div>
    </van-radio-group>

    <van-goods-action class="flex-content-end">
      <div class="flex-x flex-content-center">
        <div style="font-size: 16px;">合计：</div>
        <div class="price">¥4999.00</div>
      </div>
      <van-goods-action-button to="/orderSuccess" type="danger" text="立即购买" @click="onClickButton" />
    </van-goods-action>
  </div>
</template>

<script>
export default {
  name: 'createOrder',
  data () {
    return {
      text: '',
      payment: {}
    }
  },
  mounted () {
    console.log(this.$route.params);
  }
}
</script>

<style lang="scss" scoped>
.warpper {
  background-color: #F8F8F8;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 50px;
  height: 100vh;
  box-sizing: border-box;

  >.block {
    background-color: #fff;
    border-radius: 4px;
    padding: 10px;
  }
}

.van-goods-action-button {
  padding: 0 20px;
  flex: none;
  width: max-content;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 5px;
  padding-bottom: 5px;

  .title {
    flex: 1;
    white-space: nowrap;
  }

  .van-cell {
    flex: 2;
  }

  &+& {
    border-top: 1px solid #CCC;
  }
}

.van-cell {
  padding: 0;
}

.price {
  font-size: 16px;
  font-weight: bold;
  color: #FF6700;
}

.photo {
  width: 60px;
  height: 80px;
  margin: 0 10px;
}
</style>